home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2518 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. Path: info.spt.net.cn!usenet
  2. From: Xu Yifeng <jafd@public.sta.net.cn>
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: Performance: C vs. C++
  5. Date: Mon, 15 Jan 1996 10:25:37 -0800
  6. Organization: ZheJiang Securities Co.Ltd
  7. Message-ID: <30FA9C21.14EC@public.sta.net.cn>
  8. References: <30F6BAAC.12B5@iastate.edu>
  9. NNTP-Posting-Host: ts1-20.sta.net.cn
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (Win16; I)
  14.  
  15. Steve Lee wrote:
  16. > Hi,
  17. > : I was wondering if anyone could tell me what the difference in performance 
  18. :would be between
  19. : writing a program in C++ vs. C.  Assume that the compilers are both of 
  20. :equal quality.  I know
  21. : that certain features such as virtual functions and exception handling add 
  22. :overhead.  Are there
  23. : any others?  If you don't implement these features that add the extra 
  24. :overhead, is C++ directly
  25. : comparable to C in performance then?  The only other reason I could see C++ 
  26. :being slower than C
  27. : is programming style.  Object-oriented is slower since there are more 
  28. :layers, hence function call
  29. : overhead.
  30. : Anyone with some answers, disagreements?  Thanks.
  31. : --
  32. : Steve Lee
  33. : Computer Engineering/Computer Science
  34. : Iowa State University
  35. : email -> sjlee@iastate.edu
  36.  
  37. Hi,
  38.  
  39. I don't think C++ will slower than C, because if you want to use C 
  40. to implement Object Oriented Mothed in you program,you will need to
  41. manually construct you virtual functions table and data structure lay
  42. it is diffcult, and programming speed will slow down! On the side,
  43. C is slower than C++.
  44.  
  45. Both in C and C++, if you don't need Object Oriented Mothed, they
  46. have same speed, but C++ is more powerfull.
  47.  
  48. All in all, C++ is better that C.
  49.  
  50. Regards,
  51. Xu yifeng
  52.